package com.bishe.demo.modules.other.dao;

import com.bishe.demo.modules.other.entity.TravelImage;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface TravelImageDao {
    @Insert("insert into other_travel_image values(null,#{travelId},#{imageId})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insertTravelImage(TravelImage travelImage);

    @Delete("delete from other_travel_image where travel_id=#{travelId}")
    void deleteTravelImageByTravelId(int travelId);

    @Delete("delete from other_travel_image where image_id=#{imageId}")
    void deleteTravelImageByImageId(int imageId);

    @Select("select image_id from other_travel_image where travel_id=#{travelId}")
    List<Integer> getImagesIds(int travelId);
}
